import http from '@/utils/request'

//更新token
export async function refreshTokenApi(parm){
  return await http.post("/user/refreshToken",parm)
}

//登录
export async function login(parms){
  return await http.login("/user/login",parms);
}

//获取用户信息
export async function getInfo(){
  return await http.get("/user/getInfo")
}

//获取用户菜单信息
export async function getMenuList(){
  return await http.get("/user/getMenuList")
}

//退出登录
export async function logout(parm){
  return await http.post("/user/logout",parm)
}

//根据条件获取用户列表(除登陆者)
export async function getUserListApi(parm){
  return await http.get("/user/list",parm)
}

//新增用户
export async function addUserApi(parm){
  return await http.post("/user",parm)
}

//编辑用户
export async function editUserApi(parm){
  return await http.put("/user",parm)
}

//重置用户密码
export async function restUserPWApi(parm){
  return await http.put("/user/restPW",parm)
}

//修改状态
export async function editUserStatusApi(parm) {
  return await http.put("/user/status", parm)
}

//分配角色
export async function editUserRoleApi(parm){
  return await http.post("/user/role",parm)
}

//删除用户
export async function deleteUserApi(parm){
  return await http.delete("/user",parm)
}

//批量删除用户
export async function deleteUserBatchApi(parm){
  return await http.delete("/user/batch/delete",parm)
}

//批量导入
export async function addUserBatchApi(parm){
  return await http.upload("/user/batch/import",parm)
}

//==========用户中心部分============
//获取单个用户信息
export async function getUserAllInfo(parm){
  return await http.getRestApi("/user",parm)
}

//上传头像
export async function editUserAvatarApi(parm){
  return await http.upload("/user/avatar",parm)
}

//修改密码
export async function editUserPWApi(parm) {
  return await http.put("/user/editPW", parm)
}

//解绑邮箱
export async function editUserEmailStatusApi(parm) {
  return await http.put("/user/emailStatus", parm)
}

//==========辅助场馆管理部分============
//获取符合场馆管理员的用户
export async function getFieldUserManagerApi(parm){
  return await http.get("/user/fieldUserManager",parm)
}

//登录重置密码
export async function forgetPWApi(parm){
  return await http.get("/user/forgetPWD",parm)
}
